package com.victor.controller.mobile;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.victor.entity.Myuser;
import com.victor.service.SetupService;
import com.victor.utils.Msg;

/**
 * 设置相关Controller
 * 
 * @author Mr.Zhang
 *
 */
@RestController
@RequestMapping("/setup")
public class SetupController {

	@Autowired
	private SetupService setupService;

	// 远程添加用户(添加userid和用户类型)
	@RequestMapping("/addMyuser")	
	public Msg addMyuser(String userid, String user_type) {// 用户类别(0.普通用户,1.vip用户)
		if (userid.equals("") || user_type.equals("")) {
			return Msg.fail("参数错误");
		}
		boolean insResult = setupService.addMyuser(userid, user_type);
		return Msg.judge(insResult);
	}

	// 修改设置信息
	@RequestMapping("/updateSetup")
	public Msg updateSetup(Myuser myuser) {
		if (myuser.getId() == 0) {
			return Msg.fail("参数错误");
		}
		boolean updResult = setupService.updateSetup(myuser);
		return Msg.judge(updResult);
	}
}
